package com.example.zk2.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query

@Dao
interface HisDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(history: History)

    @Delete
    fun delete(history: History)
    //order by id desc  //desc 降序  默认升序 asc   //like '%'||:keyword||'%' 数据库模糊查询
   /* @Query("select * from history where phone = :phone  and  keyword like '%'||:keyword||'%'")
    fun query(phone:String,keyword:String):MutableList<History>*/

    @Query("select * from history where phone = :phone")
    fun query(phone:String):MutableList<History>
}